//
//  YWPatrollineRecord.m
//  maintain
//
//  Created by Kyo on 16/2/22.
//  Copyright © 2016年 ewin. All rights reserved.
//

#import "YWPatrollineRecord.h"
#import "MJExtension.h"
#import "YWHandler.h"
#import "YWKeepWatchMission.h"

@implementation YWPatrollineRecord

+ (NSDictionary*)mj_replacedKeyFromPropertyName
{
    return @{ @"patrolMan" : @"executor",
              @"result" : @"resultCode",
              @"recordId" : @"keepWatchRecordId"};
}

+ (NSArray *)mj_ignoredPropertyNames
{
    return @[@"executorIds"];
}

+ (NSDictionary *)mj_objectClassInArray{
    return @{@"executors" : @"YWHandler",
             @"details" : @"YWPatrolPointRecord"};
}

- (void)mj_keyValuesDidFinishConvertingToObject{
    if (self.patrolLine.patrolLineId>0) {
        self.patrolLineId = self.patrolLine.patrolLineId;
    }
    
    NSMutableString *userId = [[NSMutableString alloc] init];
    [self.executors enumerateObjectsUsingBlock:^(YWHandler*  _Nonnull handler, NSUInteger idx, BOOL * _Nonnull stop) {
        if (userId.length && idx!=0) {
            [userId appendString:@","];
        }
        [userId appendString:[@(handler.uniqueId) stringValue]];
    }];
    self.executorIds = [NSString stringWithFormat:@"%@",userId];
}
@end

@implementation YWKeepWatchMissionInfoJson
+ (NSDictionary *)mj_objectClassInArray{
    return @{@"replies" : @"YWReply"};
}
@end
